<template>
  <div>
    <h1>地图</h1>
    <div class="map" id="bd_map_d"></div>
  </div>
</template>

<script setup>
import { nextTick, onMounted,getCurrentInstance } from "vue";
let {proxy}=getCurrentInstance()
onMounted(() => {
  nextTick(() => {
    initMap();
  });
});
const initMap = () => {
  let map = new BMapGL.Map("bd_map_d"); // 创建地图实例
  let point = new BMapGL.Point(116.404, 39.915); // 创建点坐标
  map.centerAndZoom(point, 15); // 初始化地图，设置中心点坐标和地图级别
  map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放
  map.setTrafficOn(); // 添加交通流量图层
};
</script>

<style lang='scss' scoped>
#bd_map_d {
  width: 100%;
  height: 600px;
}
</style>